#include "onevideoinfo.h"
#include "ui_onevideoinfo.h"

void onevideoinfo::addoneevaluate( QString time,QString content_type,QString content,QString name,QString image,int istalk,QString position)
{
    oneevaluate* oe=new oneevaluate;
    oe->time=time;
    oe->content=content;
    oe->content_type=content_type;
    oe->name=name;
    oe->image=image;
    if(istalk==1)
    {
        oe->istalk=true;
        oe->position=position;
    }
    else
        oe->istalk=false;
    evaluates.push_back(oe);
}

void onevideoinfo::initUi()
{
    if(displayvideolength)
        ui->videolength->setText(this->videolength);
    else
        ui->videolength->setVisible(false);
    ui->videoname->setText(this->sign);
    ui->author->setText(this->author);
    ui->playnum->setText(QString::number(this->playnum));
    ui->talknum->setText(QString::number(this->evaluatenum));
    ui->issuetime->setText(this->issuetime);
    ui->backimage->setStyleSheet(QString("border-image:url('%1')").arg(this->image));

}

// void onevideoinfo::initdata(int id, int fm, int cm, int sm, QString image, QString sign, QString vd, QString author, QString length, QString issuetime, QString ai, int playnum)
// {
//     this->videoid=id;
//     this->favornum=fm;
//     this->storagenum=sm;
//     this->image=image;
//     this->sign=sign;
//     this->videoaddress=vd;
//     this->author=author;
//     this->videolength=length;
//     this->issuetime=issuetime;
//     this->authorimage=ai;
//     this->playnum=playnum;
// }



void onevideoinfo::renewwatchposition(QString position)
{
    this->position=position;
}

void onevideoinfo::sethistoryattribute()
{
    ui->videolength->setText(QString(this->position+"/"+this->videolength));
}

void onevideoinfo::duplicateone(onevideoinfo *one)
{
    this->videoid=one->videoid;
    this->favornum=one->favornum;
    this->storagenum=one->storagenum;
    this->image=one->image;
    this->sign=one->sign;
    this->videoaddress=one->videoaddress;
    this->author=one->author;
    this->videolength=one->videolength;
    this->issuetime=one->issuetime;
    this->authorimage=one->authorimage;
    this->playnum=one->playnum;
    this->evaluatenum=one->evaluatenum;
    this->evaluates=one->evaluates;
    this->position=one->position;
    this->udpsocket=one->udpsocket;
}



onevideoinfo::onevideoinfo(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::onevideoinfo)
{
    ui->setupUi(this);
}

onevideoinfo::~onevideoinfo()
{
    delete ui;
}



